// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) definits fieldsfirst ansi space safe 
// Source File Name:   LondonSimulation.java

package jones;

import java.util.Iterator;
import java.util.List;
import jones.behavior.LondonTask;
import jones.behavior.SimplePriorityListArbiter;
import jones.behavior.Task;
import jones.rigid.RigidBody;

// Referenced classes of package jones:
//            SimpleSimulation, Light, SimpleRobot, Wall, 
//            HockeyPuck, Simulation, World

public class LondonSimulation extends SimpleSimulation
    implements Simulation
{

    private static final int XMIN = 0;
    private static final int YMIN = 0;
    private static final int XMAX = 574;
    private static final int YMAX = 544;
    private static final String NAME = "London";

    public LondonSimulation()
    {
        initSimulation();
    }

    public LondonSimulation(LondonSimulation simulation)
    {
        for (Iterator i = simulation.lights.iterator(); i.hasNext(); lights.add(((Object) (new Light((Light)i.next())))));
        for (Iterator i = simulation.robots.iterator(); i.hasNext(); robots.add(((Object) (new SimpleRobot((SimpleRobot)i.next(), world)))));
        for (Iterator i = simulation.rigidBodies.iterator(); i.hasNext();)
        {
            RigidBody rigidBody = (RigidBody)i.next();
            if (rigidBody instanceof Wall)
                rigidBodies.add(((Object) (new Wall((Wall)rigidBody))));
            else
            if (rigidBody instanceof HockeyPuck)
                rigidBodies.add(((Object) (new HockeyPuck((HockeyPuck)rigidBody))));
        }

        super.initRigidBodies();
        super.initSimObjects();
        super.initObservables();
        super.initWorld();
        super.initSimulator();
        world.setLatency(simulation.world.getLatency());
        world.setFantasyMode(simulation.world.isFantasyMode());
    }

    public Simulation copySimulation()
    {
        return ((Simulation) (new LondonSimulation(this)));
    }

    public Simulation createNewSimulation()
    {
        return ((Simulation) (new LondonSimulation()));
    }

    protected void initRobots()
    {
        SimpleRobot robot = new SimpleRobot(50D, 50D, 0.0D, world);
        Task londonTask = ((Task) (new LondonTask()));
        robot.setBehaviors(londonTask.getBehaviors());
        robot.setArbiter(((jones.behavior.Arbiter) (new SimplePriorityListArbiter(((SimpleRobotInterface) (robot)), londonTask.getBehaviors()))));
        robots.add(((Object) (robot)));
    }

    protected void initRigidBodies()
    {
        super.initRigidBodies();
        int WIDTH = 6;
        int PATH = 100;
        int XSTEP = 93;
        int YSTEP = 86;
        rigidBodies.add(((Object) (new Wall(100D, 272D, 474D, 272D, 6D))));
        rigidBodies.add(((Object) (new Wall(287D, 100D, 287D, 269D, 6D))));
        rigidBodies.add(((Object) (new Wall(287D, 275D, 287D, 444D, 6D))));
        rigidBodies.add(((Object) (new Wall(103D, 100D, 103D, 186D, 6D))));
        rigidBodies.add(((Object) (new Wall(100D, 189D, 193D, 189D, 6D))));
        rigidBodies.add(((Object) (new Wall(190D, 186D, 190D, 100D, 6D))));
        rigidBodies.add(((Object) (new Wall(471D, 100D, 471D, 186D, 6D))));
        rigidBodies.add(((Object) (new Wall(474D, 189D, 381D, 189D, 6D))));
        rigidBodies.add(((Object) (new Wall(384D, 186D, 384D, 100D, 6D))));
        rigidBodies.add(((Object) (new Wall(103D, 444D, 103D, 358D, 6D))));
        rigidBodies.add(((Object) (new Wall(100D, 355D, 193D, 355D, 6D))));
        rigidBodies.add(((Object) (new Wall(190D, 358D, 190D, 444D, 6D))));
        rigidBodies.add(((Object) (new Wall(471D, 444D, 471D, 358D, 6D))));
        rigidBodies.add(((Object) (new Wall(474D, 355D, 381D, 355D, 6D))));
        rigidBodies.add(((Object) (new Wall(384D, 358D, 384D, 444D, 6D))));
    }

    protected void initWorld()
    {
        super.initWorld();
        world.setLatency(0);
    }

    public String getName()
    {
        return "London";
    }
}
